{"ast":null,"code":"import _objectSpread from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";export var findContactOrReturnNull=function findContactOrReturnNull(searchedUser,currentUser,collectionContacts){var contact={};collectionContacts.items.forEach(function(item,index){if(item.fromUser.id===searchedUser.id&&item.toUser.id===currentUser.id||item.toUser.id===searchedUser.id&&item.fromUser.id===currentUser.id){contact={index:index,contact:_objectSpread({},item)};}});if(contact&&contact.contact){return contact;}return{contact:null};};","map":{"version":3,"names":["findContactOrReturnNull","searchedUser","currentUser","collectionContacts","contact","items","forEach","item","index","fromUser","id","toUser"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/utils/Contact.ts"],"sourcesContent":["import {UserListItem} from \"../models/response/UserListItem\";\nimport {ContactListResponse} from \"../models/response/ContactListResponse\";\nimport {ContactWithIndex} from \"../models/props/ContactWithIndex\";\nimport React from \"react\";\n\nexport const findContactOrReturnNull = (\n    searchedUser: UserListItem,\n    currentUser: UserListItem,\n    collectionContacts: ContactListResponse\n    ): ContactWithIndex => {\n    let contact = {} as ContactWithIndex;\n\n    collectionContacts.items.forEach((item, index) => {\n        if (\n            (item.fromUser.id === searchedUser.id && item.toUser.id === currentUser.id) ||\n            (item.toUser.id === searchedUser.id && item.fromUser.id === currentUser.id)\n        ) {\n            contact = {\n                index: index,\n                contact: {...item}\n            }\n        }\n    });\n\n    if (contact && contact.contact) {\n        return contact;\n    }\n\n    return {\n        contact: null\n    };\n}\n"],"mappings":"6IAKA,MAAO,IAAMA,wBAAuB,CAAG,QAA1BA,wBAAuB,CAChCC,YAA0B,CAC1BC,WAAyB,CACzBC,kBAAuC,CAChB,CACvB,GAAIC,QAAO,CAAG,CAAC,CAAqB,CAEpCD,kBAAkB,CAACE,KAAK,CAACC,OAAO,CAAC,SAACC,IAAI,CAAEC,KAAK,CAAK,CAC9C,GACKD,IAAI,CAACE,QAAQ,CAACC,EAAE,GAAKT,YAAY,CAACS,EAAE,EAAIH,IAAI,CAACI,MAAM,CAACD,EAAE,GAAKR,WAAW,CAACQ,EAAE,EACzEH,IAAI,CAACI,MAAM,CAACD,EAAE,GAAKT,YAAY,CAACS,EAAE,EAAIH,IAAI,CAACE,QAAQ,CAACC,EAAE,GAAKR,WAAW,CAACQ,EAAG,CAC7E,CACEN,OAAO,CAAG,CACNI,KAAK,CAAEA,KAAK,CACZJ,OAAO,kBAAMG,IAAI,CACrB,CAAC,CACL,CACJ,CAAC,CAAC,CAEF,GAAIH,OAAO,EAAIA,OAAO,CAACA,OAAO,CAAE,CAC5B,MAAOA,QAAO,CAClB,CAEA,MAAO,CACHA,OAAO,CAAE,IACb,CAAC,CACL,CAAC"},"metadata":{},"sourceType":"module"}